window.onload = function() {
	//获取元素对象

	//给元素加背景色
	var trs = document.getElementsByTagName('tr');
	for(var i = 0; i < trs.length; i++) {
		var tds = trs[i].getElementsByTagName('td');
		for(var j = 0; j < tds.length; j++) {
			if(i % 2 == 0) {
				tds[j].style.background = (j % 2 == 0 ? 'lightskyblue' : 'palevioletred');
			} else {
				tds[j].style.background = (j % 2 == 0 ? 'palevioletred' : 'lightskyblue');
			}
		}
	}
};